<template>
	<view class="container">
		<navSearchBar title="我的活动单"></navSearchBar>
		<scroll-view class="scroll" scroll-y @scrolltolower="loadMore">
		<view class="list">
			<view class="list-item flex-col-between" v-for="item in list" @click="toCustomer(item)">
				<text>{{item.name}}</text>
				<image src="../../static/personal/right.png" mode=""></image>
			</view>
		</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				page:2,
				pageSize:15
			};
		},

		onLoad() {

			this.getCustomer()
		},
		methods:{
			async getCustomer() {
				uni.showLoading({
					title: '加载中'
				})
				let res = await this.$api.activeList({limit:this.page* this.pageSize})
				if(res.data.status) {
					uni.hideLoading();
					this.list = res.data.data.data
				}
				console.log(this.list,"list")
			},
			loadMore() {
				if(this.list.length <= this.page * this.pageSize) return
				this.page++
				this.getCustomer()
				console.log(111111)
			},
			toCustomer(item) {
				this.$Router.push({name:"activeCustomer",query:{id:item.id}})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		display: flex;
		flex-direction: column;
		height: 100vh;
		overflow: hidden;
	}
	
	.scroll {
		flex: 1;
		height: 100%;
	}
	.list {
		padding: 30rpx 40rpx 30rpx 20rpx;
		.list-item {
			height: 112rpx;
			border-bottom: 2rpx solid #EFEFEF; 
			text {
				line-height: 28rpx;
				font-size: 28rpx;
				color: #000000;
			}
			image {
				width: 10rpx;
				height: 20rpx;
			}
		}
	}
</style>
